<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        body{
            /*一定注意，父元素是不进行任何的定位的*/
            /*position: relative;*/
        }
        .sky{
            width: 300px;
            height: 300px;
            background-color: pink;
            left: 0;
            right: 0;
            bottom: 0;
            top: 0;
            position: absolute;
            margin: auto;
        }
    </style>
</head>
<body>
    <div class="sky">
        在页面居中
    </div>
</body>
</html>